import { defineStore } from "pinia";

const useUserStore = defineStore("user", {
  state: () => {
    return {
      UID: "",
      name: "",
      isExpert: true,
      pwd: "",
      status: 1,
    };
  },
  persist: true,
  getters: {
    getUID: (state) => state.UID,
    getName: (state) => state.name,
  },
  actions: {
    setUID(newUID: string) {
      this.UID = newUID;
    },
    setName(newName: string) {
      this.name = newName;
    },
    setPwd(newPwd: string) {
      this.pwd = newPwd;
    },
    setStatus(newStatus: number) {
      this.status = newStatus;
    },
  },
});

export { useUserStore };
